//
//  @ Project : Galaxy Star Trading System
//  @ File Name : Indicator.h
//  @ Date : 2014/9/5
//  @ Author :
//
//
#if !defined(_CINDICATOR_H)
#define _CINDICATOR_H

namespace GSTrader
{
	namespace Indicator
	{
		class INDICATOR_API CIndicator 
		{
		public:
			CIndicator();
			CIndicator(CSeries* pInput);
			
			virtual ~CIndicator();

			virtual CIndicator* CreateInstance() = 0;


			virtual void Calculate();
			virtual double Calculate(int nIndex);

			virtual int  GetCount();
			virtual void SetParam(double* pdParam);
			virtual void SetInputSeries(CSeries* pSeries);
			virtual void RefreshData();
   
			void RemoveFirst();
			void Clear();

			virtual string GetIndicatorName();

			double GetResult(int nIndex);
			double GetResultValue(int nResultIndex, int nDataIndex);
			double GetResultValueByName(string strResultName, int nDataIndex);

		private:
			CIndicator(const CIndicator& indi);

		public:
			void Attach();
			void Detach();
			void InternalCalculate(int nIndex);

		public:
			string m_strIndicatorName;
			bool m_bCalc;
			bool m_bAutoUpdate;
			CSeries* m_pInput;

			CIndicatorResult* m_pResult;
			vector<CIndicatorResult*> m_vResult;
		};	
	}
}


#endif  //_CINDICATOR_H
